from sqlalchemy import false

global_map = {}

def set_value(key, value):
    global global_map
    global_map[key] = value

def get_value(key):
    return global_map.get(key)

def delete_value(key):
    global global_map
    global_map.pop(key, None)

#内存存储user_id
def set_user_id(thread_id: str, user_id: str):
    set_value(thread_id+"_user_id", user_id)

def get_user_id(thread_id: str):
    return get_value(thread_id+"_user_id")

# 内存清理user_id
def delete_user_id(thread_id: str):
    delete_value(thread_id+"_user_id")

#内存存储跳过tool_call的线程
def set_skip_tool_call_thread(thread_id: str):
    set_value("skip"+thread_id, True)

def get_skip_tool_call_thread(thread_id: str):
     skip_tool_call = get_value("skip"+thread_id)
     if skip_tool_call is None:
         return False
     return skip_tool_call

def delete_skip_tool_call_thread(thread_id: str):
    delete_value("skip"+thread_id)